package com.horizon.manage.item.converter;

import com.horizon.common.converter.HorizonBaseEvdConverter;
import com.horizon.manage.item.dto.ItemDTO;
import com.horizon.manage.item.entity.Item;
import com.horizon.manage.item.vo.ItemVO;
import org.springframework.stereotype.Component;

/**
 * 项目实体、视图、DTO转换器.
 *
 * @author zhaoshb
 * @since 2022/12/7 22:41
 */
@Component
public class ItemEvdConverter extends HorizonBaseEvdConverter<Item, ItemVO, ItemDTO> {

    @Override
    public Item dtoToEntity(ItemDTO dto) {
        Item item = new Item();
        item.setId(dto.getId());
        item.setName(dto.getName());
        return item;
    }

    @Override
    public ItemVO entityToVO(Item entity) {
        ItemVO itemVO = new ItemVO();
        itemVO.setId(entity.getId());
        itemVO.setName(entity.getName());
        return itemVO;
    }
}
